package ldh.im.fxbase.data.pojo.status;

import ldh.im.dto.enums.ModuleItemType;
import ldh.rpc.dto.ValueEnum;

public enum ImModuleItemType implements ValueEnum<Byte> {
    page(1,"html页面"),
    origin(2,"原生"),
    ;

    private Byte value;
    private String desc;

    private ImModuleItemType(Integer value, String desc) {
        this.value = value.byteValue();
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }


    public static ImModuleItemType getByValue(Integer value) {
        if (value == null) return null;
        for (ImModuleItemType labelStatus : ImModuleItemType.values()) {
            if (labelStatus.getValue() == value.byteValue()) {
                return labelStatus;
            }
        }

        throw new RuntimeException("ImModuleItemType不支持这个值：" + value);
    }

    public static ImModuleItemType wrap(ModuleItemType type) {
        if (type == ModuleItemType.page) {
            return page;
        } else if (type == ModuleItemType.origin) {
            return origin;
        }
        throw new RuntimeException("ImModuleItemType不支持这个值：" + type);
    }
}